package com.example.gradle_test_css.repository;

import com.example.gradle_test_css.Entity.Menutable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface MenutableRepository extends JpaRepository<Menutable,Integer> {

    @Query(value = "SELECT * FROM menu p JOIN  menu c on p.id = c.parent_id",nativeQuery = true)
    List<Menutable> menulist();
    @Query(value = "SELECT * FROM menu p where p.parent_id is null",nativeQuery = true)
    List<Menutable> findByParentIdIsNull();
}
